home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-01 | 5.3 KB | 146 lines | [TEXT/ttxt] |
- CModalProgress Read Me
- -------------- -------
-
- Version 1.0
- 1 September 1994
-
- © 1994 Alysoft Solutions. All rights reserved.
-
- The accompanying source code is released as 'freeware'. And as such you
- are free to use it in any way that you see fit. The only exception is
- that you cannot sell for profit, the source on its own. It is ok to use
- the source in other products which are then sold for profit.
-
- Items in this Archive
- ---------------------
-
- Read Me - This file
- CModalProgress.cp - The class source
- CModalProgress.h - The classes header file
- ProgressDialog.rsrc - The required resourcess for the class
-
- CTestDialogs.cp - Example source code
- CTestDialogs.h - Header file for examples
- main.cp - Main application code for example
- TestResources.rsrc - Resources for example
-
- ProgressDialog - Example application
-
- Description
- ----------
-
- The CModalProgress class provides a standard interface for displaying a
- Modal dialog during a time intensive task. The progress of the task can
- be displayed in the dialog in one of three ways:
-
- • Textual representation of the percent complete
- • A progress bar growing to the right as the task progresses
- • An infinite progress bar (as used by the Finders 'Find' command)
-
- Dialog Creation
- --------------
-
- The visual appearance of the dialog used by the CModalProgress task is
- generated in a standard DLOG and DITL resource. There are several
- important items to note:
-
- • Item 1 must be an OK equivalent button
- • Item 2 must be a CANCEL equivalent button
- • Item 3 must be a user item for the OK button outline
-
- These items are required for standard keyboard mappings. ie. the OK
- button will be activated when Enter or Return are pressed. The CANCEL
- button will be activated when ESC or Command-. are pressed.
- If this functionality is not required, the buttons should still be
- created but they should be disabled and the hidden away from view.
-
- If a progress bar or infinite progress bar are required, a user item
- should be created for the bar to be drawn into. This item is then passed
- to the SetProgressBar() or SetInfiniteBar() methods.
-
- If a textual progress indicator is required, a static text item should
- be generated for this purpose. The item number for this static text is
- then passed to the SetPercentText() method along with the frequency at
- which you want the number to be updated. ed every 1% every 5% every 20%
- etc (would take values of 1, 5, 20 repectively). Make sure that this
- item is Enabled. If it is not, it will not be used by the clase.
-
- Class Use
- ---------
-
- The progress class breaks the task into separate states each state taking
- up a certain percentage of the total task time (except for the infinite
- progress bar).
-
- Each state contains a resolution or a state space that is set as the task
- progresses. eg The Finder's Copy command whould have a read and then a
- write state. The state space may correspond to the size of the file, the
- copy command would increment the current state value each block that was
- read and then written.
-
- eg. The Finder Copy Command.
-
- Copying one file that is 128k in size.
-
- • Generate CModalProgress object
- • Provide DLOG resource ID
- • call SetProgressBar() with the user item of the progress bar
- • call SetCurrentState(50), 50 being 50% of total tasks as the first
- thing we will do is the reading which takes half of the time.
- • call SetStateSpace(128), 128 is our state space. As we read in each
- 1k block of the file we will increment the state value, when it
- reaches 128 we are done.
- • call BeginModal(), start the ball rolling...Show the window.
- • Do read processing, calling SetCurrentStateValue() each block we
- read.
-
- Repeat similar for thw write processing
-
- • call SetCurrentState(100), this state goes from 50 up to 100 %
- • call SetStateSpace(128), representing the 128k of data
- • Do the write processing.
- • call EndModal()
- • delete the CModalProgress object
-
- The state space for the current state should be set to any value that is
- directly related to the processing task. As in the above example, the
- state space was set 128 as the data being read in was going to be 128k.
- Or if you are processing a text file, the state space may be the number
- of lines to process. Then each line that is processed, the modalprogress
- object is notified and it updates the progress bar or text accordingly.
-
- Other Information
- ----------------
-
- Forming part of this archive is a small application showing several
- examples of how to use the CModalProgress class. The code for these
- examples is included for further reference.
-
- Registration
- -----------
-
- As previously stated, this software is 'freeware'. However, if you wish
- to register with me that you are using this package, I can forward any
- modifications, bug fixes etc to you as soon as they are available.
-
- Also, if you find any bugs in the code you can forward reports to me and
- will eventually receive updates to fix the problems.
-
- Any other form of criticism, suggestions etc will be most welcome.
-
- Contact Address
- ---------------
-
- Postal:
- Alysoft Solutions
- PO Box 387
- Wollongong East
- New South Wales 2520
- Australia.
-
- E-Mail:
- heathcot@bnr.ca
-
- Phone:
- 61-42-841400 (think about the timezone first!!)
-